<HTML>
<HEAD>
<TITLE>
AutumnConfig.h
</TITLE>
</HEAD>
<BODY>
<PRE>
<font color="green">/*
* Copyright 2006 the original author or authors.
* 
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* 
*      http://www.apache.org/licenses/LICENSE-2.0
* 
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/</font>

<font color="blue">#ifndef</font> AUTUMN_AUTUMNCONFIG_H
<font color="blue">#define</font> AUTUMN_AUTUMNCONFIG_H

<font color="blue">#include</font> <font color="maroon">&#60;string&#62;</font>
<font color="blue">#include</font> <font color="maroon">&#60;map&#62;</font>
<font color="blue">#include</font> <font color="maroon">&#60;vector&#62;</font>
<font color="blue">#include</font> <font color="maroon">"IResource.h"</font>
<font color="blue">#include</font> <font color="maroon">"ILibrary.h"</font>
<font color="blue">#include</font> <font color="maroon">"BeanConfig.h"</font>

<font color="blue">using</font> <font color="blue">namespace</font> std;

<font color="blue">namespace</font> Autumn<font color="black">{</font>

<font color="green">/** 
 * Autumn configuration, include bean, library.
 * @version 0.1.0
 * @since 2006-12-6
 */</font>
<font color="blue">class</font> AutumnConfig<font color="black">{</font>
    <font color="green">/** All dynamic libraries */</font>
    vector<font color="black">&#60;</font>ILibrary<font color="black">*</font><font color="black">&#62;</font> Libs;

    <font color="green">/** All Beans */</font>
    map<font color="black">&#60;</font>string, BeanConfig<font color="black">*</font><font color="black">&#62;</font> Beans;

    <font color="green">/** All customized types,  */</font>
    vector<font color="black">&#60;</font>string<font color="black">&#62;</font> TypeNames;
    
    <font color="green">/** Deal with each dynamic library */</font>
    <font color="blue">void</font> processLibrary<font color="black">(</font>TLibrary<font color="black">&</font> lib<font color="black">)</font>;

    <font color="green">/** Deal with each bean */</font>
    <font color="blue">void</font> processBean<font color="black">(</font>TBean<font color="black">&</font> bean, ILibrary<font color="black">*</font> pl<font color="black">)</font>;
    
    <font color="green">/** 
     * Name mangler
     * @param objType Type of object
     * @param op Operation on object
     * @param objName Name of object
     */</font>
    string mangleName<font color="black">(</font><font color="blue">const</font> string<font color="black">&</font> objType, <font color="blue">const</font> string<font color="black">&</font>  op, 
            <font color="blue">const</font> string<font color="black">&</font> objName<font color="black">)</font>;

<font color="blue">public</font><font color="black">:</font>
    <font color="green">/** Constructor */</font>
    AutumnConfig<font color="black">(</font>IResource<font color="black">*</font> config<font color="black">)</font>;

    <font color="green">/** Destructor */</font>
    ~AutumnConfig<font color="black">(</font><font color="black">)</font>;
    
    <font color="green">/** Set a bean's configuration */</font>
    <font color="blue">void</font> setBeanConfig<font color="black">(</font><font color="blue">const</font> string<font color="black">&</font> <font color="blue">name</font>, BeanConfig<font color="black">*</font> pb<font color="black">)</font><font color="black">{</font>
        <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>Beans.insert<font color="black">(</font>make_pair<font color="black">(</font><font color="blue">name</font>, pb<font color="black">)</font><font color="black">)</font>;
    <font color="black">}</font>

    <font color="green">/** Get a bean's configuration by name */</font>
    BeanConfig<font color="black">*</font> getBeanConfig<font color="black">(</font><font color="blue">const</font> string<font color="black">&</font> <font color="blue">name</font><font color="black">)</font> <font color="blue">const</font>;
    
    <font color="green">/** Get all customized types */</font>
    <font color="blue">const</font> vector<font color="black">&#60;</font>string<font color="black">&#62;</font><font color="black">*</font> getAllTypes<font color="black">(</font><font color="black">)</font> <font color="blue">const</font> <font color="black">{</font>
        <font color="blue">return</font> <font color="black">&</font><font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>TypeNames;
    <font color="black">}</font>
<font color="black">}</font>;

<font color="black">}</font> <font color="green">// End namespace Autumn</font>
<font color="blue">#endif</font>

</PRE>
</BODY>
</HTML>
